package cn.yj.core.business.controller;

import cn.yj.cgs.dba.entity.vo.CommentVo;
import cn.yj.admin.frame.AbstractController;
import cn.yj.syslog.common.LogType;
import cn.yj.syslog.common.OperateLog;
import cn.yj.core.business.service.CommentService;
import cn.yj.entity.R;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author 永健
 * @since 2021-06-09 15:16
 */
@RequestMapping("/comment")
@RestController
public class CommentController extends AbstractController<CommentVo> {

    @Resource
    private CommentService commentService;

    @Override
    @GetMapping("/pageList")
    @RequiresPermissions("comment:list")
    public R pageList(@RequestParam Map<String, Object> params) {
        return success(commentService.pageList(params, page()));
    }


    @OperateLog(describe = "删除评论",type = LogType.DELETE)
    @RequiresPermissions("comment:del")
    @DeleteMapping("/delete/{commentNo}")
    public R delete(@PathVariable String commentNo) {
        return result(commentService.deleteByNo(commentNo));
    }

}
